home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / c80tcog.lbr / CTYPE.CQ / ctype.c
Text File  |  1985-08-09  |  2KB  |  88 lines

  1. /* ctype.c - character classification functions                       */
  2. /*                                                      1982/10/10 12:21
  3.  
  4.         Copyright 1982  William G. Hutchison, Jr.
  5.                         P.O. Box 278
  6.                         Exton, PA 19341-0278
  7.                         U.S.A.
  8.  
  9.                         CompuServe 70665,1307
  10.  
  11.  
  12.     These functions may be used freely for any non-commercial
  13. purpose, provided that the user does  not  remove  or  alter
  14. this notice or the copyright statement.
  15.     Those who wish to  sell  or lease these functions, or to
  16. incorporate them into a product for  sale or  lease,  should
  17. apply to the author (above) for licensing information.
  18.     These functions are not  covered by  a  warranty, either
  19. express or implied. The author shall not be responsible  for
  20. any  damages (including consequential) caused by reliance on
  21. the  materials  presented,  including  but  not  limited  to
  22. typographical errors or arithmetic errors.
  23.  
  24.     NOTE: The names and functions of these sub-programs  are
  25. the  same  as  certain  sub-programs provided  with the UNIX
  26. system (tm Western Electric Co.), but these sub-programs are
  27. original work, not copies of the UNIX sub-programs.
  28.  
  29.  */
  30.  
  31. /*      definitions for Software Toolworks C/80 Version 2.0:    */
  32. #ifdef MAINLY
  33. #else
  34. #include "c80def.h"
  35. #endif
  36.  
  37. #ifdef ASCII
  38. isalnum(c) char c;
  39. {
  40.         return(isalpha(c) || isdigit(c));
  41. }
  42. isalpha(c) char c;
  43. {
  44.         return(islower(c) || isupper(c));
  45. }
  46. isascii(c) char c;
  47. {
  48.         int b;
  49.         return(0 <= (b=c & 0xFF) && b <= 0x7F);
  50. }
  51. iscntrl(c)/* is c a control character */ char c;
  52. {
  53.         int b;
  54.         return((0 <= (b=c & 0xFF) && b < ' ') || b == 0x7F);
  55. }
  56. isdigit(c) char c;
  57. {
  58.         return('0' <= c && c <= '9');
  59. }
  60. islower(c) char c;
  61. {
  62.         return('a' <= c && c <= 'z');
  63. }
  64. ispunct(c)/* is c punctuation? */ char c; 
  65. {
  66.         return(
  67.         isascii(c) && !(isalnum(c) || iscntrl(c)));
  68. }
  69. isprint(c) char c;
  70. {
  71.         return(' ' <= c && c < 0x7F);
  72. }
  73. isspace(c) char c;
  74. {
  75.         return(
  76.         (c == ' ')
  77.     ||    (c == '\t')
  78.     ||    (c == '\n')
  79.     ||    (c == '\015') /* CR */
  80.     ||    (c == '\014') /* FF */
  81.     );
  82. }
  83. isupper(c) char c;
  84. {
  85.         return('A' <= c && c <= 'Z');
  86. }
  87. #endif
  88.